Skip to main content

componentTests

Multi stacked bar Chart – Component test plan

Sub-components: Bar, Legends, Callout

  1. Bar: bar data, bar variants like ‘part-to-whole’ and ‘absolute-scale’
  2. Legends: show/hide legends, highlight the corresponding bar on legend hover
  3. Callout: Default/custom callout
  4. Screen resolution changes, theme changes
Test stepsValidationTool used
Test 1: [Snapshot testing]
- With only data prop, non-empty dataRenders multi stacked bar chart correctlyEnzyme
- With empty dataRenders multi stacked bar chart correctlyRTL
- With HideLegend prop set to “true”Should hide legendsEnzyme
- With HideTooltip prop set to “true”Should hide the tooltip in chartEnzyme
- With HideRatio set to “true”Should not show ratio on top of multi stacked bar chartEnzyme
- With HideDenominator set to “true”Should not show the denominator for the ratio above the chartEnzyme
- With variant set to “AbsoluteScale”Should render absolute-scale variant correctlyEnzyme
- With variant set to “AbsoluteScale” and “HideLabels” set to “true”Should not render bar labels in absolute-scale variantEnzyme
Test 2: Basic props testing
- HideLegend prop set to “false”Should mount legend when hideLegend is falseEnzyme
- HideTooltip prop set to “false”Should mount callout when hideTootip is falseEnzyme
- HideDenominator set to “false”Should not mount calloutEnzyme
- onRenderCalloutPerDataPoint is givenShould render onRenderCalloutPerDataPointEnzyme
- onRenderCalloutPerDataPoint is not givenShould not render onRenderCalloutPerDataPointEnzyme
Test 3: Render calling with respective to props
- No prop changes: Mount multi stacked bar chart and then set the same props againRender function should have been called twiceEnzyme
- Prop changes: Mount multi stacked bar chart and then set the some other propRender function should have been called twiceEnzyme
Test 4: Mouse events
- Mouse over on a barShould render callout correctly on mouseoverEnzyme
- Mouse over on a bar with customized calloutShould render customized callout on mouseoverEnzyme
- Mouse move on a barShould render callout correctly on mousemoveEnzyme
Test 5: Render empty chart aria label div when chart is empty
- Multi stacked bar chart mounted with non-empty dataNo empty chart aria label div renderedEnzyme
- Multi stacked bar chart mounted with empty dataEmpty chart aria label div renderedEnzyme
Test 6: [Sub-Component]: Multi stacked bar
- Specify bar heightShould render the bar with the given heightRTL
- With variant set to “PartToWhole”Should render the variant correctly and for a single bar, the sum of the width of the rectangles should equal to 100%.RTL
- With variant set to “AbsoluteScale”Should render the variant correctly and for a single bar with the highest width, the sum of the width of the rectangles should equal to 100% and for the rest of the bars, the sum should be < 100%.RTL
- Localize the numbers of the bars with a given cultureShould render the bars with the numbers localized in the given cultureE2E
- Specify the href for the multi stacked barShould redirect to the Url to upon clicking on the multi stacked bar chartE2E
Test 7: [Sub-Component]: Legends
- Hover mouse over bar legendsShould reduce the opacity of the other bars and their legendsRTL
- Mouse out from a bar legendShould change the opacity of the other bars and their legends on mouse out action from a bar legendRTL
- Click on a bar legendShould reduce the opacity of the other bars and their legends on mouse click a bar legendRTL
- Legends overflow scenarioOverflow button should contain the additional legendsE2E
- Placeholder data scenarioShould not show any legends when a datapoint is marked as placeholderRTL
Test 8: [Sub-Component]: Callout
- Hover mouse over a barShould call the handler on mouse over barRTL
- Hover mouse over a barShould show the default callout over that barRTL
- Specify custom callout and hover mouse over a barShould show the custom callout over that barRTL
Test 9: [Sub-Component]: Screen resolution
- Increase the screen resolution (zoom in)Should remain unchanged on zoom inRTL
- Decrease the screen resolution (zoom out)Should remain unchanged on zoom outRTL
Test 10: Theme changed to Dark ThemeShould reflect theme changeRTL